//
//  QXTextView.m
//  WanCaiC8
//
//  Created by tangang on 2018/4/3.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "QXTextView.h"

@implementation QXTextView

- (void)drawRect:(CGRect)rect{
    [super drawRect:rect];
    [self addAccessoryView];
}

- (void)addAccessoryView{
    UIView *accessorView = [[UIView alloc]initWithFrame:CGRectMake(0, 0,SCREEN_WIDTH, 35*myY)];
    accessorView.backgroundColor = DEFAULTBGCOLOR;
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake((375-50)*myY, 0, 50*myX, 35*myY)];
    //    btn.backgroundColor = [UIColor greenColor];
    [btn setTitle:@"完成" forState:UIControlStateNormal];
    [btn setTitleColor:DEFAULTTEXTBLACKCOLOR forState:UIControlStateNormal];
    [accessorView addSubview:btn];
    accessorView.userInteractionEnabled = YES;
    [btn addTarget:self action:@selector(doneClick) forControlEvents:UIControlEventTouchUpInside];
    self.inputAccessoryView = accessorView;
}

- (void)doneClick{
    [[UIApplication sharedApplication].keyWindow endEditing:YES];
}

@end
